sysroot: Add ostree_sysroot_get_fd()
authorColin Walters <walters@verbum.org>
Fri, 17 Apr 2015 13:13:31 +0000 (09:13 -0400)
committerColin Walters <walters@verbum.org>
Fri, 17 Apr 2015 18:15:11 +0000 (14:15 -0400)
This way external programs like rpm-ostree can do fd-relative
operations on the deployment directories, like inspecting the RPM
database.

Closes: https://github.com/GNOME/ostree/pull/91
doc/ostree-sections.txt
src/libostree/ostree-sysroot.c
src/libostree/ostree-sysroot.h

index efb160f885b7d35d95a05368d57e0e71a3e3994b..d26d37a4f26d6889fa974006fd3c6d44e1e272db 100644 (file)
@@ -365,6 +365,7 @@ ostree_sysroot_new
 ostree_sysroot_new_default
 ostree_sysroot_get_path
 ostree_sysroot_load
+ostree_sysroot_get_fd
 ostree_sysroot_ensure_initialized
 ostree_sysroot_get_bootversion
 ostree_sysroot_get_subbootversion
index 6d622402dbb3d1772ad3ec5ae548ef8423ab4f5e..b18c6b706fbe4539b86827940b0107e0b85fdfb8 100644 (file)
@@ -196,6 +196,23 @@ ensure_sysroot_fd (OstreeSysroot          *self,
   return TRUE;
 }
 
+/**
+ * ostree_sysroot_get_fd:
+ * @self: Sysroot
+ *
+ * Access a file descriptor that refers to the root directory of this
+ * sysroot.  ostree_sysroot_load() must have been invoked prior to
+ * calling this function.
+ * 
+ * Returns: A file descriptor valid for the lifetime of @self
+ */
+int
+ostree_sysroot_get_fd (OstreeSysroot *self)
+{
+  g_return_val_if_fail (self->sysroot_fd != -1, -1);
+  return self->sysroot_fd;
+}
+
 /**
  * ostree_sysroot_ensure_initialized:
  * @self: Sysroot
index 4342470f93d81a0ce387f77ba9cbdb4113bc18c3..fe6441fb14086e1b1c4ca7ff48c35f912b54d5a6 100644 (file)
@@ -39,6 +39,8 @@ OstreeSysroot* ostree_sysroot_new_default (void);
 
 GFile *ostree_sysroot_get_path (OstreeSysroot *self);
 
+int ostree_sysroot_get_fd (OstreeSysroot *self);
+
 gboolean ostree_sysroot_load (OstreeSysroot  *self,
                               GCancellable   *cancellable,
                               GError        **error);